﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/masDefault.master" AutoEventWireup="true"
    CodeFile="User.aspx.cs" Inherits="WebTeamplate.Admin_User" %>

<%@ Register Assembly="Control" Namespace="PagerControl" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ctMain" runat="Server">
    <div class="ui-state-default ui-corner-top ui-box-header">
        <span class="ui-icon float-left ui-icon-notice"></span>Tìm kiếm
    </div>
    <div class="content-box-wrapper">
        <br />
        <table width="100%" cellpadding="0" cellspacing="0" border="0">
            <tr class="row">
                <td style="width: 170px;" class="labelRight">
                    Họ tên:
                </td>
                <td style="width: 280px;" class="labelLeft">
                    <asp:TextBox ID="F_txtName" Width="270px" MaxLength="50" CssClass="txt adminControl"
                        runat="server"></asp:TextBox>
                </td>
                <td style="width: 110px;" class="labelRight">
                    Tên đăng nhập:
                </td>
                <td class="labelLeft" style="width: 240px;">
                    <asp:TextBox ID="F_txtUserName" Width="200px" MaxLength="50" CssClass="txt adminControl"
                        runat="server"></asp:TextBox>
                </td>
                <td>
                </td>
            </tr>
            <tr class="row">
                <td class="labelRight">
                    Email:
                </td>
                <td class="labelLeft">
                    <asp:TextBox ID="F_txtEmail" Width="200px" MaxLength="50" CssClass="txt adminControl"
                        runat="server"></asp:TextBox>
                </td>
                <td class="labelRight">
                    Giới tính:
                </td>
                <td class="labelLeft">
                    <asp:DropDownList ID="F_drlGender" runat="server" CssClass="drp adminControl">
                    </asp:DropDownList>
                </td>
                <td>
                </td>
            </tr>
            <tr class="row">
                <td class="labelRight">
                    Tình trạng:
                </td>
                <td class="labelLeft">
                    <asp:RadioButtonList ID="F_rblStatus" runat="server" RepeatColumns="3" RepeatDirection="Vertical"
                        RepeatLayout="Table">
                        <asp:ListItem Text="Tất cả" Selected="True" Value=""></asp:ListItem>
                        <asp:ListItem Text="Đã kích hoạt" Value="1"></asp:ListItem>
                        <asp:ListItem Text="Chưa kích hoạt" Value="0"></asp:ListItem>
                    </asp:RadioButtonList>
                </td>
                <td>
                </td>
                <td>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td align="left">
                    <asp:Button ID="btnSearch" runat="server" Text="Search" CssClass="ui-state-default ui-corner-all ui-state-focus"
                        OnClick="btnSearch_Click" />
                    <asp:Button ID="btnReset" OnClientClick="return Reset();" runat="server" Text="Làm lại"
                        CssClass="ui-state-default ui-corner-all ui-state-focus" />
                </td>
                <td colspan="3">
                </td>
            </tr>
        </table>
    </div>
    <table class="noneborder" style="width: 100%;">
        <tr>
            <td>
                <asp:Button ID="btnDelete" runat="server" CssClass="ui-state-default ui-corner-all ui-state-focus"
                    OnClientClick="return CheckDelete();" OnClick="btnDelete_Click" />
                <asp:Button ID="btnAddNew" runat="server" CssClass="ui-state-default ui-corner-all ui-state-focus"
                    OnClick="btnAddNew_Click" />
            </td>
            <td align="right" width="500px">
                <cc1:Pager ID="pagerTop" runat="server" Visible="false" />
            </td>
        </tr>
    </table>
    <div class="hastable">
        <table cellspacing="0">
            <asp:Repeater ID="rptData" runat="server" OnItemDataBound="rptData_ItemDataBound"
                OnItemCommand="rptData_ItemCommand">
                <HeaderTemplate>
                    <thead>
                        <tr>
                            <td style="width: 30px">
                                <%=Resources.Resource.RowHeaderNo%>
                            </td>
                            <td style="width: 150px">
                                <asp:LinkButton ID="lbtnUserName" CssClass="headerLink" runat="server" CommandName="SortOrder"
                                    CommandArgument="UserName" Text="Tên đăng nhập">                         
                                </asp:LinkButton>
                            </td>
                            <td>
                                <asp:LinkButton ID="lbtnName" CssClass="headerLink" runat="server" CommandName="SortOrder"
                                    CommandArgument="Name" Text="Họ và tên">                         
                                </asp:LinkButton>
                            </td>
                            <td style="width: 190px">
                                Email
                            </td>
                            <td style="width: 80px">
                                <%=Resources.Resource.RowHeaderPublish%>
                            </td>
                            <td style="width: 90px">
                            </td>
                        </tr>
                    </thead>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td class="repeaterCenterData">
                            <asp:Literal ID="ltrNo" runat="server"></asp:Literal>
                        </td>
                        <td class="repeaterLeftData">
                            <asp:Literal ID="ltrUserName" runat="server"></asp:Literal>
                        </td>
                        <td class="repeaterLeftData">
                            <asp:Literal ID="ltrName" runat="server"></asp:Literal>
                        </td>
                        <td class="repeaterLeftData">
                            <asp:Literal ID="ltrEmail" runat="server"></asp:Literal>
                        </td>
                        <td class="repeaterCenterData">
                            <asp:ImageButton ID="btnPublish" runat="server" ImageUrl="~/App_Themes/Admin/images/tick.png"
                                CommandName="Approved" />
                        </td>
                        <td class="repeaterCenterData">
                            <asp:HyperLink ID="hplEdit" Text="Edit" runat="server"></asp:HyperLink>
                            |
                            <asp:LinkButton ID="lbtnDelete" runat="server" Text="Delete" CommandName="delete"
                                OnClientClick="return ConfirmDelete();"></asp:LinkButton>
                        </td>
                    </tr>
                </ItemTemplate>
                <AlternatingItemTemplate>
                    <tr class="alt">
                        <td class="repeaterCenterData">
                            <asp:Literal ID="ltrNo" runat="server"></asp:Literal>
                        </td>
                        <td class="repeaterLeftData">
                            <asp:Literal ID="ltrUserName" runat="server"></asp:Literal>
                        </td>
                        <td class="repeaterLeftData">
                            <asp:Literal ID="ltrName" runat="server"></asp:Literal>
                        </td>
                        <td class="repeaterLeftData">
                            <asp:Literal ID="ltrEmail" runat="server"></asp:Literal>
                        </td>
                        <td class="repeaterCenterData">
                            <asp:ImageButton ID="btnPublish" runat="server" ImageUrl="~/App_Themes/Admin/images/tick.png"
                                CommandName="Approved" />
                        </td>
                        <td class="repeaterCenterData">
                            <asp:HyperLink ID="hplEdit" Text="Edit" runat="server"></asp:HyperLink>
                            |
                            <asp:LinkButton ID="lbtnDelete" runat="server" Text="Delete" CommandName="delete"
                                OnClientClick="return ConfirmDelete();"></asp:LinkButton>
                        </td>
                    </tr>
                </AlternatingItemTemplate>
            </asp:Repeater>
        </table>
    </div>
    <table class="noneborder" style="width: 100%;">
        <tr>
            <td>
                &nbsp;
            </td>
            <td align="right" width="500px">
                <cc1:Pager ID="pagerBottom" Visible="false" runat="server" />
            </td>
        </tr>
    </table>
    <input type="hidden" id="hidListId" runat="server" value="" />
    <input type="hidden" id="hidListIdSelect" runat="server" value="" />

    <script type="text/javascript">

        function Reset() {
            document.getElementById('<%=F_txtName.ClientID %>').value = '';
            document.getElementById('<%=F_txtUserName.ClientID %>').value = '';
            document.getElementById('<%=F_txtEmail.ClientID %>').value = '';
            document.getElementById('<%=F_drlGender.ClientID %>').value = '';
            SetValueForRadioButtonList('<%=F_rblStatus.ClientID %>', '');
            return false;
        }
        // return the value of the radio button that is checked
        function ConfirmDelete() {
            var yes = confirm('<%=Resources.Resource.ConfirmDelete %>');
            return yes;
        }
        function CheckDelete() {
            var id = document.getElementById('<%=hidListIdSelect.ClientID %>').value;
            if (id == '') {
                alert('<%=Resources.Resource.RequireSelect %>');
                return false;
            }
            else return ConfirmDelete();

        }
        function CheckItem(id, status) {

            var idSelect = document.getElementById('<%=hidListIdSelect.ClientID %>').value;
            if (status) {
                idSelect += id + ';';
            }
            else idSelect = idSelect.replace(id + ';', '');
            if (idSelect.length == document.getElementById('<%=hidListId.ClientID %>').value.length) {
                document.getElementById('chkCheckAll').checked = true;
            }
            else
                document.getElementById('chkCheckAll').checked = false;
            document.getElementById('<%=hidListIdSelect.ClientID %>').value = idSelect;
        }
        function ChekAll(status) {

            var id = document.getElementById('<%=hidListId.ClientID %>').value;
            var arr = new Array();
            arr = id.split(';');
            if (arr.length > 0) {
                for (var i = 0; i < arr.length; i++) {
                    if (document.getElementById('chk_' + arr[i].toString())) {
                        document.getElementById('chk_' + arr[i].toString()).checked = status;

                    }
                }

            }
            if (status) {
                document.getElementById('<%=hidListIdSelect.ClientID %>').value = id;
            }
            else document.getElementById('<%=hidListIdSelect.ClientID %>').value = '';
        }
       
    </script>

</asp:Content>
